Fix json-insert unibyte buffer bug (bug#70007)
authorMattias Engdegård <mattiase@acm.org>
Tue, 2 Apr 2024 16:58:09 +0000 (18:58 +0200)
committerMattias Engdegård <mattiase@acm.org>
Tue, 2 Apr 2024 17:10:00 +0000 (19:10 +0200)
commit617debf67392946b4b42fdf364c69da6f094a840
tree5d65b382c66e8ddbe25bf24e1cf1538e4f533d34
parent0670032c0dc03c0df6e11b5411b8d10fc61a7d41
Fix json-insert unibyte buffer bug (bug#70007)

Previously, a unibyte target buffer could be put in an incorrect state
if json-insert was used to insert non-ASCII characters.

* src/json.c (Fjson_insert): Simplify.  Don't attempt to decode the data
being inserted: it is guaranteed to be correct UTF-8 and is correct for
both unibyte and multibyte buffers.
* test/src/json-tests.el (json-serialize/roundtrip)
(json-serialize/roundtrip-scalars): Extend tests.
src/json.c
test/src/json-tests.el